package com.zxl.live.screen.screen.ui.helper;

import android.text.TextUtils;

import com.zxl.live.screen.screen.ui.helper.data.SuiScreenDataHelper;
import com.zxl.live.screen.screen.ui.helper.data.SuiScreenExDataHelper;
import com.zxl.live.tools.tools.FileUtil;

/**
 * Created by Administrator on 2018/2/12.
 */

public class DataHelper {

    public static boolean hasDownloadFile(SuiScreenDataHelper.DataType dataType, int position) {
        return !TextUtils.isEmpty(getDownloadPath(dataType, position));
    }

    public static String getDownloadPath(SuiScreenDataHelper.DataType dataType, int position) {
        String path = getFirstDownloadPath(dataType, position);
        if (FileUtil.isFileExist(path)) {
            return path;
        }
        path = getSecondDownloadPath(dataType, position);
        if (FileUtil.isFileExist(path)) {
            return path;
        }
        return null;
    }

    public static String getFirstDownloadPath(SuiScreenDataHelper.DataType dataType, int position) {
        return SuiScreenDataHelper.getMaxImagePath(dataType, position);
    }

    public static String getFirstDownloadUrl(SuiScreenDataHelper.DataType dataType, int mPosition) {
        return SuiScreenDataHelper.getMaxImage(dataType, mPosition);
    }

    public static String getSecondDownloadPath(SuiScreenDataHelper.DataType dataType, int position) {
        return SuiScreenExDataHelper.getMaxImagePath(dataType, position);
    }

    public static String getSecondDownloadUrl(SuiScreenDataHelper.DataType dataType, int mPosition) {
        return SuiScreenExDataHelper.getMaxImage(dataType, mPosition);
    }
}
